The present invention is related generally to the field of computer graphics, and more particularly, to calculating color values in a computer graphics processing system through adaptive transformation of fractional pixel coordinates.
In two-dimensional (xe2x80x9c2Dxe2x80x9d) graphics, scaling is an important feature. Scaling is the ability to increase or decrease the size of an image. The scaling feature has many uses, such as editing graphic images, decreasing the size of an image so that the entire image fits on a screen, or increasing the image size for easy viewing of image detail. However, when scaling an image, the quality of the image is often degraded. For example, where an image is enlarged, the image resolution decreases and the result is that curves and lines that appeared smooth in the original image appear jagged and pixilated in the enlarged image.
A conventional approach to improving the image quality of a scaled image is the use of bilinear interpolation. Shown in FIG. 1 is a conventional bilinear interpolation circuit 10. In conventional applications of bilinear interpolation for image scaling, the color value Cp of a destination pixel in the enlarged image is calculated from weighting the color values Ct0-Ct3 of the closest four adjacent source pixels of the original image. The weighting is based on the destination pixel""s coordinates, or fractional coordinates (rU, rV). Thus, in the case where an image is being enlarged, the transition from one color to another in the enlarged image appears more uniform and smooth because the color value for the destination pixels are dependent on the color values of the adjacent source pixel colors in the original image. The resulting enlarged image maintains an acceptable image quality.
Although bilinear interpolation works well for images where color transitions from one pixel to another is relatively gradual, problems occur where the color transition from one pixel to another is dramatic, for example, in the case of dark colored text on a light colored background. When bilinear interpolation is applied to images where the color gradient is severe, the resulting enlarged image appears xe2x80x9cfuzzyxe2x80x9d because the pixels along the edge of the enlarged image have a color value that is an interpolated value of the light background and the dark text. In the typical case, where the text is black and the background is white, these pixels appear gray, causing the enlarged image to lose some of its sharpness.
Bicubic interpolation has been used to maintain the image quality of an enlarged image. Bicubic interpolation calculates the color value of a pixel in the enlarged image from the color value of the closest four pixels along one coordinate using a cubic function to weight the color values. Calculations are performed along each of the u and v coordinates, and as a result, the color value of the destination pixel is influenced by sixteen (4xc3x974) adjacent source pixels. The resulting enlarged image results in a more natural appearance, and consequently, enlarged images do maintain an acceptable level of sharpness.
Although using bicubic interpolation for scaling operations is an improvement over the use of bilinear interpolation, bicubic interpolation may cause xe2x80x9cringingxe2x80x9d artifacts in the enlarged image, especially near sharp edges in the source content, for example, text. Moreover, the improvement in image quality of the enlarged image resulting from applying bicubic interpolation comes at the price of space overhead. A circuit that performs bicubic interpolation is considerably more complicated and requires more space on a semiconductor die than a circuit performing bilinear interpolation. Thus, although using bicubic interpolation for scaling operations results in good image quality, the cost is increased circuit complexity and reduction of space overhead. Where high circuit integration, or a reduction in overall circuit size is desired, including a circuit capable of performing bicubic interpolation may not be acceptable.
Therefore, there is a need for a system and method for scaling graphics images that results in acceptable image quality while addressing the space overhead concerns of conventional scaling circuitry employing bicubic interpolation.
The present invention is directed toward an adaptive interpolation circuit and method for calculating an interpolated color value for a pixel from color values of adjacent pixels. The adaptive interpolation circuit includes first and second look-up-tables (LUTs) to store a plurality of values. Each of the LUTs has a selection circuit that receives an index value corresponding to a respective coordinate value of the pixel and selects one of the stored values to provide to an interpolation circuit according to the received index value. In addition to receiving a selected value from each LUT, the interpolation circuit also has color input terminals to receive the color values of the adjacent pixels. The interpolation circuit calculates the pixel""s interpolated color value by weighting the color values of the adjacent pixels according to the selected values provided by the first and second LUT. Thus, rather than determining the pixel""s color value from directly applying the pixel""s relative coordinate values in the color weighting calculation, the pixel""s color value is determined from weighting the selected values provided to the interpolation circuit by the LUTs. Consequently, various interpolation functions may be simulated by the adaptive interpolation circuit by programming the appropriate values in the LUTs for the pixel""s relative coordinates.